home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / lh211src.zip / SLIDEHUF.H < prev    next >
C/C++ Source or Header  |  1991-01-11  |  3KB  |  105 lines

  1. #include <stdio.h>
  2. #include <limits.h>
  3. #include "typedef.h"
  4. #include "errmes.h"
  5.  
  6. struct encode_option {
  7.     void (*output)();
  8.     void (*encode_start)();
  9.     void (*encode_end)();
  10. };
  11.  
  12. struct decode_option {
  13.     ushort (*decode_c)();
  14.     ushort (*decode_p)();
  15.     void (*decode_start)();
  16. };
  17.  
  18. /* from slide.c */
  19. #define MAX_DICBIT    13 
  20. #define MAX_DICSIZ (1U << MAX_DICBIT)
  21. #define MATCHBIT   8    /* bits for MAXMATCH - THRESHOLD */
  22. #define MAXMATCH 256    /* formerly F (not more than UCHAR_MAX + 1) */
  23. #define THRESHOLD  2    /* choose optimal value */
  24.  
  25. extern int unpackable;
  26. extern ulong origsize, compsize;
  27. extern ushort dicbit;
  28. extern ushort maxmatch;
  29. extern ulong count;
  30. extern ushort loc;
  31. #if 0
  32. extern uchar *text;
  33. #else
  34. extern uchar text[];
  35. #endif
  36.  
  37. /* from huf.c */
  38. #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
  39.                                 /* alphabet = {0, 1, 2, ..., NC - 1} */
  40. #define CBIT 9  /* $\lfloor \log_2 NC \rfloor + 1$ */
  41. #define USHRT_BIT 16    /* (CHAR_BIT * sizeof(ushort)) */
  42.  
  43. extern ushort left[], right[];
  44. extern uchar c_len[], pt_len[];
  45. extern ushort c_freq[], c_table[], c_code[],
  46.               p_freq[], pt_table[], pt_code[],
  47.               t_freq[];
  48.  
  49. void output_st1(ushort c, ushort p);
  50. void far *alloc_buf(void);
  51. void encode_start_st1(void);
  52. void encode_end_st1(void);
  53. ushort decode_c_st1(void);
  54. ushort decode_p_st1(void);
  55. void decode_start_st1(void);
  56.  
  57. /* from shuf.c */
  58. void decode_start_st0(void);
  59. void encode_p_st0(unsigned short j);
  60. void encode_start_fix(void);
  61. void decode_start_fix(void);
  62. ushort decode_c_st0(void);
  63. ushort decode_p_st0(void);
  64.  
  65. /* from dhuf.c */
  66. extern uint n_max;
  67.  
  68. void start_c_dyn(void);
  69. void decode_start_dyn(void);
  70. ushort decode_c_dyn(void);
  71. ushort decode_p_dyn(void);
  72. void output_dyn(int code, unsigned int pos);
  73. void encode_end_dyn(void);
  74.  
  75. /* from larc.c */
  76. ushort decode_c_lzs(void);
  77. ushort decode_p_lzs(int loc);
  78. ushort decode_c_lz5(void);
  79. ushort decode_p_lz5(int loc);
  80. void decode_start_lzs(void);
  81. void decode_start_lz5(void);
  82.  
  83. /* from maketbl.c */
  84. void make_table(short nchar, uchar bitlen[],
  85.                 short tablebits, ushort table[]);
  86.  
  87. /* from maketree.c */
  88. void make_code(short n, uchar len[], ushort code[]);
  89. short make_tree(short nparm, ushort freqparm[], 
  90.                 uchar lenparm[], ushort codeparam[]);
  91.  
  92. /* from crcio.c */
  93. extern FILE *infile, *outfile;
  94. extern ushort crc, bitbuf;
  95. extern int dispflg;
  96.  
  97. void fillbuf(uchar n);
  98. ushort getbits(uchar n);
  99. void putcode(uchar n, ushort x);
  100. void putbits(uchar n, ushort x);
  101. int fread_crc(uchar *p, int n, FILE *f);
  102. void fwrite_crc(uchar *p, int n, FILE *f);
  103. void init_getbits(void);
  104. void init_putbits(void);
  105.